package com.example;

import de.greenrobot.daogenerator.DaoGenerator;
import de.greenrobot.daogenerator.Entity;
import de.greenrobot.daogenerator.Schema;

public class MyClass {
    public static void main(String[] args) {

        Schema schema = new Schema(1,"com.example.dllo.keepdemo.greendao");

        initData(schema);

        try {
            new DaoGenerator().generateAll(schema, "./app/src/main/java");
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    private static void initData(Schema schema) {
        //训练计划表
        Entity trainPlan = schema.addEntity("TraniPlan");
        trainPlan.addLongProperty("id").primaryKey().autoincrement();
        trainPlan.addStringProperty("title");
        trainPlan.addStringProperty("difficulty");
        trainPlan.addStringProperty("foundations");
        trainPlan.addStringProperty("equipments");
        trainPlan.addStringProperty("time");
        trainPlan.addStringProperty("body");
        trainPlan.addStringProperty("join");
        trainPlan.addStringProperty("url");

        //单次训练表
        Entity trainWorkouts = schema.addEntity("TrainWorkouts");
        trainWorkouts.addLongProperty("id").primaryKey().autoincrement();
        trainWorkouts.addStringProperty("title");
        trainWorkouts.addStringProperty("difficulty");
        trainWorkouts.addStringProperty("foundations");
        trainWorkouts.addStringProperty("equipments");
        trainWorkouts.addStringProperty("time");
        trainWorkouts.addStringProperty("body");
        trainWorkouts.addStringProperty("join");

        //发现页表
        Entity dynamicFind = schema.addEntity("DynamicFind");
        dynamicFind.addLongProperty("id").primaryKey().autoincrement();
        dynamicFind.addStringProperty("content");
        dynamicFind.addStringProperty("likes");
        dynamicFind.addStringProperty("comment");
        dynamicFind.addStringProperty("url");

        //关注页表
        Entity dynamicAttention = schema.addEntity("DynamicAttention");
        dynamicAttention.addLongProperty("id").primaryKey().autoincrement();
        dynamicAttention.addStringProperty("title");
        dynamicAttention.addStringProperty("image1");
        dynamicAttention.addStringProperty("image2");
        dynamicAttention.addStringProperty("image3");

        //最新页表
        Entity dynamicLatest = schema.addEntity("DynamicLatest");
        dynamicLatest.addLongProperty("id").primaryKey().autoincrement();
        dynamicLatest.addStringProperty("imgHead");
        dynamicLatest.addStringProperty("picture");
        dynamicLatest.addStringProperty("name");
        dynamicLatest.addStringProperty("city");
        dynamicLatest.addStringProperty("content");
        dynamicLatest.addStringProperty("time");
        dynamicLatest.addStringProperty("metaName");
        dynamicLatest.addStringProperty("count");
        dynamicLatest.addStringProperty("praise");
        dynamicLatest.addStringProperty("comment");

    }
}
